<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>X-admin v1.0</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="format-detection" content="telephone=no">
        <link rel="stylesheet" href="/woniu/Public/X-admin/css/x-admin.css" media="all">
    </head>
    
    <body>
        <div class="x-body">
            <form class="layui-form" method="post" action="/woniu/index.php/Home/Major/update" >
            	<input type="hidden" id="ids" name="id" value="<?php echo ($id); ?>">

                <?php if(is_array($list)): foreach($list as $key=>$rows): ?><div class="layui-form-item">
                        <label for="username" class="layui-form-label"><?php echo ($rows[0]); ?></label>
                        <div class="layui-input-inline">
                            <input type="text" id="<?php echo ($rows[0]); ?>" name="<?php echo ($rows[0]); ?>"  value="<?php echo ($rows[1]); ?>" class="layui-input">
                        </div>
                    </div><?php endforeach; endif; ?>

                <div class="layui-form-item">
                    <label for="L_repass" class="layui-form-label"></label>
                    <button  class="layui-btn" lay-filter="" lay-submit="">确认修改</button>
                </div>
            </form>
        </div>
        <script src="/woniu/Public/X-admin/lib/layui/layui.js" charset="utf-8">
        </script>
        <script src="/woniu/Public/X-admin/js/x-layui.js" charset="utf-8">
        </script>
        <script>
            layui.use(['form','layer'], function(){
                $ = layui.jquery;
              var form = layui.form();
              layer = layui.layer;

              //监听提交
              form.on('submit(add)', function(data){
                
                console.log(data);
                
                ids = $("#ids").val();
                majorname = $("#majorname").val();
                $.post('/woniu/index.php/Home/Major/update',{ids:ids,majorname:majorname},function(data){
                    if(data=="修改成功"){
                        // alert("数据增加成功");
                        //加载当前frame
                        // var index = parent.layer.getFrameIndex(window.name);
                        //关闭当前frame
                        // parent.layer.close(index);
                        // return false;
                        // aaa=1;
                    }else{
                        alert('数据修改失败');
                        return false;
                    }
                });
                // layer.alert("修改成功", {icon: 6,time:2000},function () {
                //     // 获得frame索引
                //     var index = parent.layer.getFrameIndex(window.name);
                //     //关闭当前frame
                //     parent.layer.close(index);
                // });
                // return false;
              });
            }); 
        </script>
    </body>

</html>